package tech.aistar.mapper;

import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import tech.aistar.entity.Cost;
import tech.aistar.entity.CotenancyRequire;
import tech.aistar.entity.Register;

import java.util.List;

public interface CotenancyRequireMapper {
    @Select("select * from cotenancy_require")
    List<CotenancyRequire> selectAll();
    @Insert("insert into cotenancy_require(landlord_id,family,forbid_pet, tenant_stable, work_rest_normal,forbid_smoke,house_id, detail_require) value(#{landlordId},#{family},#{forbidPet}, #{tenantStable}, #{workRestNormal},#{forbidSmoke},#{houseId}, #{detailRequire})")
    void insert(CotenancyRequire cotenancyRequire);
    @Update("update cotenancy_require set tenant_id=#{tenantId},family=${family},forbid_pet=${forbidPet},half_year=#{halfYear},whole_year=#{wholeYear},tenant_stable=#{tenantStable},work_rest_normal=#{workRestNormal}, forbid_smoke=#{forbidSmoke}, house_id=#{ houseId}, detailrequire=#{detailRequire} where id=#{Id}")
    void  updateByPrimaryKey(CotenancyRequire cotenancyRequire);

    @Delete("delete from cotenancy_require where id=#{Id}")
    void deleteByPrimaryKey(Integer id);


    @Select("select * from cotenancy_require where id=#{Id}")
    CotenancyRequire findById(Integer integer);


    @Select("select * from cotenancy_require where landlord_id=#{landlordId}")
    CotenancyRequire findByLandlordId(Integer integer);

    @Select("select * from cotenancy_require where house_id=#{houseId}")
    CotenancyRequire findByhouseId(Integer integer);

}
